PESetSQLQuery
Use PESetSQLQuery to change the SQL query to the query string you supply as a parameter. Use this function to update the SQL query that will be used to print the specified report, typically to add optimizations to the WHERE clause.
C Syntax
BOOL CRPE_API PESetSQLQuery (
short printJob,
const char FAR *queryString );
Parameters
printJob
| Specifies the print job for which you want to modify the SQL query.
|
queryString
| Specifies a pointer to the null-terminated string that you want to use to replace the existing SQL query.
|
Returns
- TRUE if the call is successful.
- FALSE if the call fails.
Remarks
- This function is useful for reports with SQL queries that were explicitly edited in the Show SQL Query dialog box in Crystal Reports (that is, those reports that needed database-specific selection criteria or joins). Otherwise it is usually best to continue using function calls such as PESetSelectionFormula, and let Crystal Reports build the SQL query automatically.
- PESetSQLQuery has the same restrictions as editing in the Show SQL Query dialog box. In particular, changes are accepted in the WHERE and ORDER BY clauses but they are ignored in the SELECT list
of fields.
- This call only applies to reports created against an ODBC source or on a native SQL database connection.
VB Syntax
Declare Function PESetSQLQuery Lib "crpe32.dll" ( ByVal printJob As Integer, ByVal QueryString As String ) As Integer
Delphi Syntax
function PESetSQLQuery (
printJob: Word;
queryString: PChar
): Bool stdcall;
dBASE for Windows Syntax
EXTERN CLOGICAL PESetSQLQuery (CWORD, CSTRING) CRPE.DLL